//模拟网络延迟：延迟一段时间再返回给用户
function awaitService() {
  let time = Math.floor(Math.random() * 3 + 1) * 1000;
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve("网络畅通");
    }, time);
  });
}

//随机模拟生成token
function getToken(account) {
  let token = account + "";
  for (let i = 1; i <= 5; i++) {
    token += Math.floor(Math.random() * 5);
  }
  return token;
}

module.exports = {
  awaitService,
  getToken,
};
